using System;
using FytSoa.Common.Utils;
using System.ComponentModel.DataAnnotations;
using FytSoa.Application.Crm.Param;
using FytSoa.Application.Erp;
using FytSoa.Application.Hr;
using FytSoa.Application.Sys;
using FytSoa.Common.Enum;
using SqlSugar;

namespace FytSoa.Application.Crm;

/// <summary>
/// 添加发票信息，包含发票信息以及邮寄信息
/// </summary>
public class CrmInvoiceNewDto:CrmInvoiceAddParam
{
    
}

/// <summary>
/// 项目-发票
/// </summary>
public class CrmInvoiceDto : AppEntity
{
    /// <summary>
    /// 合同编号
    /// </summary>
    public string Number { get; set; }

    /// <summary>
    /// 项目编号
    /// </summary>
    [Required]
    public long ProjectId { get; set; }

    /// <summary>
    /// 项目
    /// </summary>
    public CrmProjectSimpleDto Project { get; set; } = new();

    /// <summary>
    /// 客户管理
    /// </summary>
    [Required]
    public long CustomerId { get; set; }

    /// <summary>
    /// 客户信息
    /// </summary>
    public CrmCustomerSimpleDto Customer { get; set; } = new();

    /// <summary>
    /// 合同编号
    /// </summary>
    [Required]
    public long ContractId { get; set; }

    /// <summary>
    /// 合同信息
    /// </summary>
    public CrmContractSimpleDto Contract { get; set; } = new();

    /// <summary>
    /// 回款编号
    /// </summary>
    public List<long> PaymentId { get; set; } = new();

    /// <summary>
    /// 回款信息
    /// </summary>
    public List<CrmPaymentSimpleDto> Payment { get; set; } = new ();

    /// <summary>
    /// 负责人
    /// </summary>
    [Required]
    public long EmployeeId { get; set; }
    
    /// <summary>
    /// 回款信息
    /// </summary>
    public HrEmployeeSimpleDto Employee { get; set; }

    /// <summary>
    /// 开票日期
    /// </summary>
    [Required]
    public DateTime InvoiceTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 金额
    /// </summary>
    [Required]
    public decimal Amount { get; set; }

    /// <summary>
    /// 开票类型
    /// </summary>
    [Required]
    public long TypeId { get; set; }
    
    /// <summary>
    /// 开票类型
    /// </summary>
    public SysCodeSimpleDto TypeCode { get; set; }

    /// <summary>
    /// 状态1=未审核1=审核中2=通过
    /// </summary>
    public CrmAuditEnum Status { get; set; } = CrmAuditEnum.NotReviewed;

    /// <summary>
    /// 备注
    /// </summary>
    public string Remark { get; set; }
    
    /// <summary>
    /// 审批流程
    /// </summary>
    [Required]
    public long FlowId { get; set; } = 0;

    /// <summary>
    /// 审批流程详情
    /// </summary>
    [Required]
    public ErpFlowDto.ErpFlowSimpleDto Flow { get; set; } = new();

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }


}